package com.easyweb.common;

import java.util.Date;
import java.util.UUID;
/**
 * 主键生成器
 * @author zhangz
 *
 */
public final class PrimaryKeyGenerator {
	
	private static final String EMPTY = "00000000000000000000000000000000";
	/**
	 * 主键生成
	 * @return
	 */
	public static String generatePrimaryKey(){
		String uuid = UUID.randomUUID().toString();
		StringBuffer sourceSb = new StringBuffer(uuid);
		sourceSb.append(new Date().getTime()).append(Math.random());
		return EncryptUtils.md5(sourceSb.toString());
	}
	/**
	 * 主键-空值
	 * @return
	 */
	public static String emptyKey(){
		return EMPTY;
	}
}
